package mxmf.entity.content;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

import chances.smart.commons.jpa.annotation.DTOAttribute;
import mxmf.entity.ArrangeAble;
import mxmf.entity.CmsEntity;
import mxmf.entity.OpPermissionable;
import mxmf.entity.PictureAble;

@MappedSuperclass
public class Content extends CmsEntity
        implements ArrangeAble, PictureAble, OpPermissionable {

    private static final long serialVersionUID = 1L;

    @Column(name = "name", length = 64)
    @DTOAttribute(name = "名称")
    protected String name;

    @Column(name = "original_name", length = 64)
    @DTOAttribute(name = "曾用名")
    protected String originalName;

    @Column(name = "code", length = 64)
    @DTOAttribute(name = "编码", update = false)
    protected String code;

    @Column(name = "type")
    @DTOAttribute(name = "类型", update = false)
    protected String type;

    @Column(name = "title", length = 64)
    @DTOAttribute(name = "标题")
    protected String title;

    @Enumerated(EnumType.ORDINAL)
    @Column(name = "enable_status", length = 2)
    protected Integer enableStatus;

    @Column(name = "valid_time")
    @DTOAttribute
    private Date validTime;

    @Column(name = "expire_time")
    @DTOAttribute
    private Date expireTime;

    @Column(name = "icon", length = 128)
    @DTOAttribute(name = "图标")
    protected String icon;

    @Column(name = "description", length = 512)
    @DTOAttribute(name = "描述")
    protected String description;

    @Column(name = "ver", length = 64)
    protected Integer ver;// 当前版本

    @Column(name = "prov_code")
    @DTOAttribute
    private String provCode;// 省级编码

    @Column(name = "city_code")
    @DTOAttribute
    private String cityCode;// 市级编码

    @Column(name = "last_change_op", length = 32)
    private String lastChangeOp;// 上一次操作 AUDIT_FAILED AUDIT_PASS CATALOG DISABLE
                                // DISABLE MODIFY

    @Override
    public String toString() {
        return "Content [name=" + name + ", code=" + code + ", type=" + type + ", enableStatus="
                + enableStatus + ", id=" + id + ", status=" + status + "]";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getEnableStatus() {
        return enableStatus;
    }

    public void setEnableStatus(Integer enableStatus) {
        this.enableStatus = enableStatus;
    }

    public Date getValidTime() {
        return validTime;
    }

    public void setValidTime(Date validTime) {
        this.validTime = validTime;
    }

    public Date getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getProvCode() {
        return provCode;
    }

    public void setProvCode(String provCode) {
        this.provCode = provCode;
    }

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getLastChangeOp() {
        return lastChangeOp;
    }

    public void setLastChangeOp(String lastChangeOp) {
        this.lastChangeOp = lastChangeOp;
    }

    public Integer getVer() {
        if (ver == null) {
            ver = 1;
        }
        return ver;
    }

    public void setVer(Integer ver) {
        this.ver = ver;
    }

    @Override
    public String getEntityType() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getOpCode() {
        // TODO Auto-generated method stub
        return null;
    }


}
